#ifndef __DKGL_BOX_H__
#define __DKGL_BOX_H__

#include "dkglMesh.h"
#include "dkglVector3.h"
#include "dkglFwdDec.h"

namespace DKGL
{
    namespace primitive
    {

        class Box : public Mesh
        {
        public:

            Box(const String&, float width, float height, float depth);

            virtual ~Box();

			virtual void setMaterial(int, MaterialPtr);

        protected:

            void allocBuf();

            void initVertexBuf(float width, float height, float depth);
            void initNormalBuf();
            void initTexcoordBuf();

            void genDisplayList();

            void renderImpl();

            int displayListId;

			// override from Drawable
			virtual bounding::Bounding* _constructBounding();
			virtual void _deconstructBounding(bounding::Bounding*);

        private:

            Box();

			Vector3 _size;

			MaterialPtr _materialPtr;
			bounding::OrientedBoundingBox* _obb;

        };

		class BoxCreator : public MeshCreator
		{
		public:
			// arg[0] = width, arg[1] = height, arg[2] = depth
			MeshPtr create(const String& name, const Arguments&);
		};

    }// namespace Primitive
}// namespace DKGL

#endif